is there a way to iterate through the values of an enum

description
No value
aliases
No value
tags
No value
created
2023-04-04T22:23:55
updated
2023-07-15T21:33:04
title
is there a way to iterate through the values of an enum
pub enum Direction {
    North,
    South,
    East,
    West,
}

impl Direction {
    pub fn iterator() -> Iter<'static, Direction> {
        static DIRECTIONS: [Direction; 4] = [North, South, East, West];
        DIRECTIONS.iter()
    }
}